#pragma once
namespace graph_virtual
{
   namespace details
   {

   }
 
   inline graph_basic::graph_int_t virtual_graph_view_t::get_vertex_count(graph_basic::graph_id_t id) const
   {
      return graph_->get_vertex_count(id);
   }  
   inline virtual_graph_t& virtual_graph_view_t::get_graph()
   {
      return *graph_;
   }   
   inline virtual_graph_t const & virtual_graph_view_t::get_graph() const
   {
      return *graph_;
   }   
   inline virtual_graph_ptr_t virtual_graph_view_t::get_graph_ptr()
   {
      return graph_;
   }   
   inline graph_basic::vertex_t& virtual_graph_view_t::operator[](graph_basic::vertex_id_t id)
   {
      return (*graph_)[id];
   }
   inline graph_basic::vertex_t const & virtual_graph_view_t::operator[](graph_basic::vertex_id_t id) const
   {
      return (*graph_)[id];
   }
   inline graph_basic::vertex_t& virtual_graph_view_t::get_vertex_by_id(graph_basic::vertex_id_t id)
   {
      return (*graph_)[id];
   }
   inline graph_basic::vertex_t const & virtual_graph_view_t::get_vertex_by_id(graph_basic::vertex_id_t id) const
   {
      return (*graph_)[id];
   }
   inline graph_basic::vertex_id_pair_t nearest_vertices(virtual_graph_view_t const & view,
                                                         graph_basic::point_t first_p, graph_basic::point_t second_p)
   {
       virtual_graph_t const & graph = view.get_graph();
       graph_basic::graph_id_t first_graph_id = graph.find_bucket(first_p);
       graph_basic::graph_id_t second_graph_id = graph.find_bucket(second_p);
       
       graph_basic::graph_ptr_t first_graph = graph.get_bucket(first_graph_id).get_graph_ptr();
       graph_basic::graph_ptr_t second_graph = graph.get_bucket(second_graph_id).get_graph_ptr();
       
       graph_basic::graph_view_ptr_t first_graph_view = view.get_view_for_graph(first_graph);
       graph_basic::graph_view_ptr_t second_graph_view = view.get_view_for_graph(second_graph);
       
       graph_basic::vertex_id_t first_nearest_id = graph_basic::nearest_vertices(*first_graph_view, first_p, graph_basic::point_t()).first;
       graph_basic::vertex_id_t second_nearest_id = graph_basic::nearest_vertices(*second_graph_view, second_p, graph_basic::point_t()).first;
       
       return graph_basic::vertex_id_pair_t(first_nearest_id, second_nearest_id);
   }

}